package com.odt.outdoor.framwork;

import android.util.Log;

/**
 * Created by shaomengjie on 2017/3/15.
 */

public class Trace {
    public static final String TAG = "framework";
    public static boolean model = true;

    public Trace() {
    }

    public static void v(String msg) {
        if(model) {
            Log.v("framework", msg + "");
        }

    }

    public static void d(String msg) {
        if(model) {
            Log.d("framework", msg + "");
        }

    }

    public static void i(String msg) {
        if(model) {
            Log.i("framework", msg + "");
        }

    }

    public static void w(String msg) {
        if(model) {
            Log.w("framework", msg + "");
        }

    }

    public static void e(String msg) {
        if(model) {
            Log.e("framework", msg + "");
        }

    }

    public static String getTraceInfo() {
        StringBuffer sb = new StringBuffer();
        StackTraceElement[] stacks = (new Throwable()).getStackTrace();
        sb.append("class: ").append(stacks[1].getClassName()).append("; method: ").append(stacks[1].getMethodName()).append("; number: ").append(stacks[1].getLineNumber());
        return sb.toString();
    }

    public static void v(String tag, String msg) {
        if(model) {
            Log.v(tag, msg + "");
        }

    }

    public static void d(String tag, String msg) {
        if(model) {
            Log.d(tag, msg + "");
        }

    }

    public static void i(String tag, String msg) {
        if(model) {
            Log.i(tag, msg + "");
        }

    }

    public static void w(String tag, String msg) {
        if(model) {
            Log.w(tag, msg + "");
        }

    }

    public static void e(String tag, String msg) {
        if(model) {
            Log.e(tag, msg + "");
        }

    }
}
